feat: add @editorjs/header package#162
Open
Reversean wants to merge 1 commit into
Open
Conversation
- Add packages/tools/header with Header block tool:
• three toolbox entries (H1/H2/H3) each carrying their level in data
• registers text + level keys in the correct order
(addEventListener before registerTextInputKey/registerValueKey,
so synchronously-fired KeyAddedEvent is never missed)
• swaps heading tag on ValueNodeChangedEvent(level)
• 36 unit tests
- Fix BlockManager.insert: pass { data, id, name } instead of
{ ...data, id, name } so tool data is not silently flattened
into top-level BlockNodeInit properties
- Fix ToolboxUI.addTool: iterate tool.toolbox (normalized array via
facade getter) with for…of instead of spreading a raw value that
may be an array or single object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
packages/tools/header— a new@editorjs/headerblock tool:data.levelpre-filledaddEventListenerbeforeregisterTextInputKey/registerValueKeyso the synchronously-dispatchedKeyAddedEventis never missed)ValueNodeChangedEvent(level)for future Block Tunes integrationFix
BlockManager.insert: pass{ data, id, name }instead of{ ...data, id, name }— the spread silently flattened tool data into top-levelBlockNodeInitproperties whichBlockNodedoesn't read, sodata.levelwas always lostFix
ToolboxUI.addTool: usetool.toolboxfacade getter (returns normalizedToolboxConfigEntry[]) and iterate withfor...ofinstead of spreading a raw value that may be an array — previously only a single broken entry was added for tools with multi-entry toolboxes